< previous page page_274 next page >

Page 274
If any of the field changes are incorrect, you would set the adStatus parameter to adStatusCancel. This would cancel the entire operation.
The Error Event
The Data control's Error event is triggered only when an error occurs during an automated process, such as the following:
8694cbadb9b1ef7075903f6f95fc1db2.gif
The Data control is loaded.
8694cbadb9b1ef7075903f6f95fc1db2.gif
A navigation button is clicked.
8694cbadb9b1ef7075903f6f95fc1db2.gif
The database specified in the DatabaseName property can't be found.
When the event is triggered, several parameters are returned to help you resolve the underlying cause of the problem. These parameters are
8694cbadb9b1ef7075903f6f95fc1db2.gif
Error NumberThe native error number
8694cbadb9b1ef7075903f6f95fc1db2.gif
DescriptionText description of the above error number
8694cbadb9b1ef7075903f6f95fc1db2.gif
ScodeThe error code that is returned by the database server
8694cbadb9b1ef7075903f6f95fc1db2.gif
SourceThe source of the error
If the CancelDisplay parameter is set to False, an attempt is made to continue with the next line of code. If the parameter is set to True (the default), an error message appears. When you write the code for the Error event, you can set the CancelDisplay parameter to False for those errors that can be corrected in your code, or to True for all the other errors that might occur.
The MoveComplete Event
This event is triggered after the current record pointer is moved to another record. You can use this event to control the movement of related Data controls on a form. For example, if you're creating an order-entry display and select a new customer, you might want to change the recordset of the orders Data control by changing the RecordSource property and then invoking the Requery method for the second Data control.
Data Control Methods
In addition to responding to events, the Data control also has several methods that you can use in your application code. Many of these methods are the same as the ones used with the ActiveX Data Objects, but you can use two unique ones: Requery and UpdateControls.
The Requery method tells the Data control to requery the database by using the query in the RecordSource property. You would need to use the Requery method for several reasons:
8694cbadb9b1ef7075903f6f95fc1db2.gif
When the Data control's RecordSource property is changed

 
< previous page page_274 next page >

If you like this book, buy it!